package com.ruoyi.binance.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.binance.mapper.BinanceHourAverageMapper;
import com.ruoyi.binance.domain.BinanceHourAverage;
import com.ruoyi.binance.service.IBinanceHourAverageService;

/**
 * 实时每时均价数据Service业务层处理
 * 
 * @author zq
 * @date 2025-08-07
 */
@Service
public class BinanceHourAverageServiceImpl implements IBinanceHourAverageService 
{
    @Autowired
    private BinanceHourAverageMapper binanceHourAverageMapper;

    /**
     * 查询实时每时均价数据
     * 
     * @param code 实时每时均价数据主键
     * @return 实时每时均价数据
     */
    @Override
    public BinanceHourAverage selectBinanceHourAverageByCode(String code)
    {
        return binanceHourAverageMapper.selectBinanceHourAverageByCode(code);
    }

    /**
     * 查询实时每时均价数据列表
     * 
     * @param binanceHourAverage 实时每时均价数据
     * @return 实时每时均价数据
     */
    @Override
    public List<BinanceHourAverage> selectBinanceHourAverageList(BinanceHourAverage binanceHourAverage)
    {
        return binanceHourAverageMapper.selectBinanceHourAverageList(binanceHourAverage);
    }

    /**
     * 新增实时每时均价数据
     * 
     * @param binanceHourAverage 实时每时均价数据
     * @return 结果
     */
    @Override
    public int insertBinanceHourAverage(BinanceHourAverage binanceHourAverage)
    {
        binanceHourAverage.setCreateTime(DateUtils.getNowDate());
        return binanceHourAverageMapper.insertBinanceHourAverage(binanceHourAverage);
    }

    /**
     * 修改实时每时均价数据
     * 
     * @param binanceHourAverage 实时每时均价数据
     * @return 结果
     */
    @Override
    public int updateBinanceHourAverage(BinanceHourAverage binanceHourAverage)
    {
        binanceHourAverage.setUpdateTime(DateUtils.getNowDate());
        return binanceHourAverageMapper.updateBinanceHourAverage(binanceHourAverage);
    }

    /**
     * 批量删除实时每时均价数据
     * 
     * @param codes 需要删除的实时每时均价数据主键
     * @return 结果
     */
    @Override
    public int deleteBinanceHourAverageByCodes(String[] codes)
    {
        return binanceHourAverageMapper.deleteBinanceHourAverageByCodes(codes);
    }

    /**
     * 删除实时每时均价数据信息
     * 
     * @param code 实时每时均价数据主键
     * @return 结果
     */
    @Override
    public int deleteBinanceHourAverageByCode(String code)
    {
        return binanceHourAverageMapper.deleteBinanceHourAverageByCode(code);
    }
}
